#include <linux/module.h>    
#include <linux/kernel.h> 
#include <linux/init.h> 
#include <linux/usb.h>
#include <linux/usb/input.h>
#include <linux/hid.h>
#include <linux/netdevice.h>

#define VENDOR_ID 0x2C7C
#define DEVICE_ID 0x0125

/* Interface is reserved */
#define RSVD(ifnum)	((BIT(ifnum) & 0xff) << 0)

static struct usb_device_id usb_test_table[] = {
//        { USB_DEVICE(VENDOR_ID, DEVICE_ID) },
        { USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID, DEVICE_ID,0xFF,0xFF,0xFF),
	  .driver_info = RSVD(1)
	},
        { } /* Terminating entry */
};

MODULE_DEVICE_TABLE(usb, usb_test_table);

static int usb_test_probe(struct usb_interface *intf,const struct usb_device_id *prod)
{
	struct usb_device *xdev;
	struct usb_driver *driver = to_usb_driver(intf->dev.driver);
	xdev = interface_to_usbdev(intf);
	printk("[%s] \n",__func__);


	/*  enable the feature for usb interface, otherwise
	*  usb_autopm_get_interface may return
	 * failure if RUNTIME_PM is enabled.
	 */
	if (!driver->supports_autosuspend) {
		driver->supports_autosuspend = 1;
		pm_runtime_enable(&intf->dev);
	}

	printk( "register '%s' at usb-%s-%s \n",
		   intf->dev.driver->name,
		   xdev->bus->bus_name, xdev->devpath);

	return 0;
}

static void usb_test_disconnect(struct usb_interface *intf)
{
	printk("[%s] \n",__func__);
}

static struct usb_driver usb_test_driver = {
	.name 		= "usb_test",
	.id_table 	= usb_test_table,
	.probe		= usb_test_probe,
	.disconnect	= usb_test_disconnect,
};


static int __init usb_test_init(void)
{
	return usb_register(&usb_test_driver);
}

static void __exit usb_test_exit(void)
{
	usb_deregister(&usb_test_driver);
}

module_init(usb_test_init);
module_exit(usb_test_exit);

MODULE_AUTHOR("BiaoWang>");
MODULE_DESCRIPTION("BiaoWang Test");
MODULE_LICENSE("GPL");
